import React, { Component } from 'react';
import '../../styles/home/MyToday.scss'
// import pic from '../assets/2.png'
import { index_goodlist } from "../../api/index";

class MyToday extends Component {
  constructor(props) {
    super(props)
    this.state = {
      list: []
    }
  }
  async componentDidMount() {
    var res = await index_goodlist()
    console.log(res.data.list);
    if (res.data.code == 200) {
      this.setState({ list: res.data.list })
    }
  }
  render() {
    return (
      <div className='today'>
        <div className='buy'>
          <p className='zuo'>今日值得买</p>
          <p className='you'>MORE→</p>
        </div>
        <div className='list1'>
          {
            this.state.list.map((item, index) => {
              return (
                <div className="item1" key={index}>
                  <img src={item.pic} alt="" />
                  <p className='p1'>{item.name}</p>
                  <p className='p2'>原价 ￥{item.salesPrice.value}</p>
                  <p className='p3'>抢购价￥<span>{item.salesPrice.value}</span></p>
                </div>
              )
            })
          }
        </div>
      </div>
    );
  }
}

export default MyToday;